var down_li = document.querySelectorAll('.drop-down')
for(let i=0;i<down_li.length;i++){
	down_li[i].onmouseover = function(){
		this.className = 'drop-down on'
	}
	down_li[i].onmouseout = function(){
		this.className = 'drop-down'
	}
}

window.onload = function(){
	//页面加载完成时，默认选中第一个菜单
	let li = document.querySelector('.links-nav > li')
	li.className = 'active';
	let links_menu = document.querySelector('.links-menu')
	links_menu.style.display = 'block'
}

var links_li = document.querySelectorAll('.links-nav > li')
var links_menu = document.querySelectorAll('.links-menu')
for(let i=0;i<links_li.length;i++){
	links_li[i].onclick = function(){
		//当有一个被点击时，清空原来的样式
		for(let j=0;j<links_li.length;j++){
			links_li[j].className = ''
			links_menu[j].style.display = 'none'
		}
		this.className = 'active'
		links_menu[i].style.display = 'block'

	}
}

var category_li = document.querySelectorAll('.category-item li')
for(let i=0;i<category_li.length;i++){
	category_li[i].onmouseover = function(){
		this.className = 'on'
	}
	category_li[i].onmouseout = function(){
		this.className = ''
	}
}